<ol class="breadcrumb">
    <li><a href="#">奇妙云箱</a></li>
    <li><a href="/box/list">箱子管理</a></li>
    <li><a href="/box/prize/list?boxid=<%= boxid %>">奖品管理</a></li>
    <li>设置奖品</li>
</ol>
<div class="panel panel-default">
    <div class="panel-heading">
        <span class="glyphicon glyphicon-pencil"></span>
        <span class="panel-title">请填写奖品信息</span>
    </div>
    <div class="panel-body">
        <form onsubmit="return check()" action="/box/prize/set" method="post" name="form1"
              class="form-horizontal">

            <div class="form-group">
                <label class="control-label col-xs-2">商品选择：</label>

                <div class="col-xs-9">
                    <select name="prize" id="prize" class="form-control">
                        <option value="0">请选择商品</option>
                        <% for(var i = 0;i < datas.length;i++){ %>
                        <option value="<%= datas[i]._id %>"><%= datas[i].name %></option>
                        <% } %>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-xs-2">活动价格：</label>

                <div class="col-xs-9">
                    <input type="text" id="discount_price" name="discount_price" class="form-control" placeholder="请输入活动价格"/>
                    <input type="text" id="boxid" name="boxid" value="<%= boxid %>" style="display: none"/>
                    <input type="text" id="index" name="index" value="<%= index %>" style="display: none"/>
                </div>
            </div>
            <div class="form-group">
                <div class="col-xs-9 col-xs-offset-2">
                    <input type="submit" class="btn btn-success col-xs-2"
                           value="提交" id="sub_btn">
                </div>
            </div>
        </form>
    </div>
</div>
<script>
    function check() {
        var imgurl = $('#discount_price').val();
        var list = $('#list').val();
        if (imgurl == '' || prize == '0') {
            $('#lert').html("<div class='alert alert-error'><h4>请完善资料.</h4></div>");
            return false;
        } else {
            return true;
        }

    }

</script>
